package org.csmzxy.class2333;

class Person {
    private String name;
    private String role;
    private String subject;
    //构造方法一
    public Person(String name,String role){
        this.name = name;
        this.role = role;
    }
    //构造方法二
    public Person(String name,String role,String subject){
        this.name = name;
        this.role = role;
        this.subject = subject;
    }
    public void print(){
        System.out.print("姓名："+ name + " ");
        System.out.print("身份："+ role + " ");
        System.out.println("教学科目："+ subject + " ");
    }
}
public class Example06 {
    public static void main(String[] args){
        //创建一个学生对象
        Person student = new Person("小明", "学生");
        student.print();
        //创建一个教师对象
        Person teachar = new Person("张伟","教师","教学");
        teachar.print();
    }
}
